*Cloud plot for fields*

clear
use "Data\kmeans ambition types.dta"

**Keep only those for who we observe ambition type**
keep if wage_growth_ambition!=.

*Keep only couples where we observe both partners
gen temp2=koen
destring temp2, replace
by couple_id aar, sort: egen temp3=mean(temp2)
keep if temp3==1.5
drop temp2 temp3

sort pnr aar

merge 1:1 pnr aar using "Data\post_secondary_fields_full_population.dta", keepusing(educ_level_field educ_level_field_num)

drop _merge

**Make map
sort pnr aar

gen temp=educ_eika if final_educ==hfaudd
by pnr: egen final_educ_level_3=mean(temp)
drop temp

forvalues i=81(1)85{

replace final_educ_level_3=1 if final_educ==1109`i'
replace final_educ_level_3=1 if final_educ==1110`i'
replace final_educ_level_3=1 if final_educ==1107`i'
replace final_educ_level_3=1 if final_educ==1008`i'
replace final_educ_level_3=1 if final_educ==1023`i'
replace final_educ_level_3=1 if final_educ==1123`i'
replace final_educ_level_3=1 if final_educ==1009`i'
replace final_educ_level_3=1 if final_educ==1022`i'
replace final_educ_level_3=1 if final_educ==1010`i'

}

gen temp=fined if final_educ==hfaudd
by pnr: egen final_educ_level_4=mean(temp)
drop temp

forvalues i=81(1)85{

replace final_educ_level_4=1 if final_educ==1109`i'
replace final_educ_level_4=1 if final_educ==1110`i'
replace final_educ_level_4=1 if final_educ==1107`i'
replace final_educ_level_4=1 if final_educ==1008`i'
replace final_educ_level_4=1 if final_educ==1023`i'
replace final_educ_level_4=1 if final_educ==1123`i'
replace final_educ_level_4=1 if final_educ==1009`i'
replace final_educ_level_4=1 if final_educ==1022`i'
replace final_educ_level_4=1 if final_educ==1010`i'

}

gen temp=educ_level_field_num if final_educ==hfaudd
by pnr: egen final_field_num=mean(temp)
drop temp

gen temp=educ_level_field if final_educ==hfaudd
by pnr: egen final_field=mode(temp), maxmode
drop temp

forvalues i=81(1)85{

replace final_field_num=1 if final_educ==1109`i'
replace final_field_num=1 if final_educ==1110`i'
replace final_field_num=1 if final_educ==1107`i'
replace final_field_num=1 if final_educ==1008`i'
replace final_field_num=1 if final_educ==1023`i'
replace final_field_num=1 if final_educ==1123`i'
replace final_field_num=1 if final_educ==1009`i'
replace final_field_num=1 if final_educ==1022`i'
replace final_field_num=1 if final_educ==1010`i'

}

forvalues i=81(1)85{

replace final_field="Primary" if final_educ==1109`i'
replace final_field="Primary" if final_educ==1110`i'
replace final_field="Primary" if final_educ==1107`i'
replace final_field="Primary" if final_educ==1008`i'
replace final_field="Primary" if final_educ==1023`i'
replace final_field="Primary" if final_educ==1123`i'
replace final_field="Primary" if final_educ==1009`i'
replace final_field="Primary" if final_educ==1022`i'
replace final_field="Primary" if final_educ==1010`i'

}

*Save*
save "Data\start_sample.dta", replace
